//
//  MHRectConst.h
//  MH
//
//  Created by SY on 2018/9/25.
//  Copyright © 2018年 SY. All rights reserved.
//

#ifndef MHRectConst_h
#define MHRectConst_h

#define MH_SCREEN_WIDTH ([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortrait ? [UIScreen mainScreen].bounds.size.width : [UIScreen mainScreen].bounds.size.height)
#define MH_SCREEN_HEIGHT ([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortrait ? [UIScreen mainScreen].bounds.size.height : [UIScreen mainScreen].bounds.size.width)
#define MH_SCREEN_BOUNDS (CGRectMake(0, 0, MH_SCREEN_WIDTH, MH_SCREEN_HEIGHT))

#define KIsiPhoneX (((int)((MH_SCREEN_HEIGHT/MH_SCREEN_WIDTH)*100) == 216)?YES:NO)
#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone6Plus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242,2208), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750,1334), [[UIScreen mainScreen] currentMode].size) : NO)

//#define MH_SCALEWIDTH(x) (x) / 375.0f * MH_SCREEN_WIDTH
//#define MH_SCALEHEIGHT(y) (y) / 667.0f * MH_SCREEN_HEIGHT
#define MH_SCALEWIDTH(x)     (KIsiPhoneX ?   ((x) * 1.104f)   : (x) / 375.0f * MH_SCREEN_WIDTH)
#define MH_SCALEHEIGHT(y)    (KIsiPhoneX ?   ((y) * 1.104f)  : (y) / 667.0f * MH_SCREEN_HEIGHT)
//iphone6设计
#define MH_PROPORHEIGHT(x) MH_SCREEN_WIDTH * (x) / 750.0f

/// 设计规范
#define StatusHight [[UIApplication sharedApplication] statusBarFrame].size.height
//获取导航栏+状态栏的高度
#define NavAndStatusHight \
({\
CGRect rectStatus = [[UIApplication sharedApplication] statusBarFrame];\    CGRect rectNav = self.navigationController.navigationBar.frame;\
( rectStatus.size.height+ rectNav.size.height);\
})\
//全局的上下的间距的设置
#define MarginSpace MH_SCALEHEIGHT(10)
#define BORDER_WIDTH_1PX            ([[UIScreen mainScreen] scale] > 0.0 ? 1.0 / [[UIScreen mainScreen] scale] : 1.0)
#define NavBarHeight 44.0f
#define TABBAR_HEIGHT ((KIsiPhoneX ?  83.0f  : 49.0f))
#define NAVBAR_HEIGHT (KIsiPhoneX ? 88 : 64)
#define SAFE_AREA (MH_SCREEN_HEIGHT - NAVBAR_HEIGHT)
/*
 1.导航栏高度 88 非IPoneX手机为64
 2.状态栏高度44 非IPoneX手机为20
 3.tabar高度83 非IPhoneX手机为49
 */
#define TABBAR_SAFE_HEIGHT  ((KIsiPhoneX ?  34  : 0))
#define NavBar_SAFE_HEIGHT  ((KIsiPhoneX ?  24  : 0))
//开发是用的安全距离

 #define TABBAR_SAFE_DEV_HEIGHT MH_SCALEHEIGHT(20)
#endif /* MHRectConst_h */
